package com.ssy.lingxi.order.model.dto;

import com.ssy.lingxi.order.model.vo.basic.request.OrderPromotionVO;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * 从多个服务查询订单商品信息返回
 * @author 万宁
 * @version 2.0.0
 * @date 2021-10-27
 */
public class OrderProductDetailDTO implements Serializable {
    private static final long serialVersionUID = 5753616442774698472L;

    public OrderProductDetailDTO() {
        this.buyerMemberId = 0L;
        this.buyerRoleId = 0L;
        this.vendorMemberId = 0L;
        this.vendorRoleId = 0L;
        this.price = BigDecimal.ZERO;
        this.refPrice = BigDecimal.ZERO;
        this.address = "";
        this.receiver = "";
        this.phone = "";
        this.promotions = new ArrayList<>();
    }

    /**
     * 采购会员Id
     */
    private Long buyerMemberId;

    /**
     * 采购会员角色Id
     */
    private Long buyerRoleId;

    /**
     * 供应会员Id
     */
    private Long vendorMemberId;

    /**
     * 供应会员角色Id
     */
    private Long vendorRoleId;

    /**
     * 商品Id
     */
    private Long productId;

    /**
     * 商品SkuId
     */
    private Long skuId;

    /**
     * 营销活动类型，定义在 OrderPromotionTypeEnum 中
     */
    private Integer promotionType;

    /**
     * 套餐主商品，关联的套餐号
     */
    private Integer groupNo;

    /**
     * 被换购商品，关联的商品SkuId
     */
    private Long parentSkuId;

    /**
     * 购买数量
     */
    private BigDecimal quantity;

    /**
     * 是否上架
     */
    private Boolean published;

    /**
     * 渠道商品库存Id
     */
    private Long stockId;

    /**
     * 购物车Id
     */
    private Long cartId;

    /**
     * 商品价格类型，1-现货价格，2-询价价格，3-积分兑换，4-赠品
     */
    private Integer priceType;

    /**
     * 商品名称
     */
    private String name;

    /**
     * 商品图片
     */
    private String logo;

    /**
     * 商品品类
     */
    private String category;

    /**
     * 商品品牌
     */
    private String brand;

    /**
     * 计价单位
     */
    private String unit;

    /**
     * 商品规格
     */
    private String spec;

    /**
     * 最小起订数
     */
    private BigDecimal minOrder;

    /**
     * 是否允许会员折扣
     */
    private Boolean discountable;

    /**
     * 折扣
     */
    private BigDecimal discount;

    /**
     * 商品阶梯价
     */
    private Map<String,Double> priceMap;

    /**
     * 单价
     */
    private BigDecimal price;

    /**
     * 到手价
     */
    private BigDecimal refPrice;

    /**
     * 供方库存
     */
    private BigDecimal stock;

    /**
     * 是否含税（true-含税，false-不含税）
     */
    private Boolean tax;

    /**
     * 税率（百分比的分子部分）
     */
    private BigDecimal taxRate;

    /**
     * 商品配送方式：1-物流，2-自提，3-无需配送
     */
    private Integer deliveryType;

    /**
     * 运费类型，1-卖家承担，2-买家承担
     */
    private Integer freightType;

    /**
     * 商品重量，当配送方式是物流时要非空且大于0
     */
    private BigDecimal weight;

    /**
     * 物流模板Id，当配送方式是物流时要非空且大于0
     */
    private Long logisticsTemplateId;

    /**
     * 发货地址id
     */
    private Long consigneeId;

    /**
     * 自提地址（如配送方式为自提，必填）
     */
    private String address;

    /**
     * 接收人（如配送方式为自提，必填）
     */
    private String receiver;

    /**
     * 接收人电话（如配送方式为自提，必填）
     */
    private String phone;

    /**
     * 是否跨境商品
     */
    private Boolean isCrossBorder;

    /**
     * 商品关联的营销活动列表，如商品没有营销活动则不需要填写此字段
     */
    private List<OrderPromotionVO> promotions;

    public Long getBuyerMemberId() {
        return buyerMemberId;
    }

    public void setBuyerMemberId(Long buyerMemberId) {
        this.buyerMemberId = buyerMemberId;
    }

    public Long getBuyerRoleId() {
        return buyerRoleId;
    }

    public void setBuyerRoleId(Long buyerRoleId) {
        this.buyerRoleId = buyerRoleId;
    }

    public Long getVendorMemberId() {
        return vendorMemberId;
    }

    public void setVendorMemberId(Long vendorMemberId) {
        this.vendorMemberId = vendorMemberId;
    }

    public Long getVendorRoleId() {
        return vendorRoleId;
    }

    public void setVendorRoleId(Long vendorRoleId) {
        this.vendorRoleId = vendorRoleId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public Integer getPromotionType() {
        return promotionType;
    }

    public void setPromotionType(Integer promotionType) {
        this.promotionType = promotionType;
    }

    public Integer getGroupNo() {
        return groupNo;
    }

    public void setGroupNo(Integer groupNo) {
        this.groupNo = groupNo;
    }

    public Long getParentSkuId() {
        return parentSkuId;
    }

    public void setParentSkuId(Long parentSkuId) {
        this.parentSkuId = parentSkuId;
    }

    public BigDecimal getQuantity() {
        return quantity;
    }

    public void setQuantity(BigDecimal quantity) {
        this.quantity = quantity;
    }

    public Boolean getPublished() {
        return published;
    }

    public void setPublished(Boolean published) {
        this.published = published;
    }

    public Long getStockId() {
        return stockId;
    }

    public void setStockId(Long stockId) {
        this.stockId = stockId;
    }

    public Long getCartId() {
        return cartId;
    }

    public void setCartId(Long cartId) {
        this.cartId = cartId;
    }

    public Integer getPriceType() {
        return priceType;
    }

    public void setPriceType(Integer priceType) {
        this.priceType = priceType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public BigDecimal getMinOrder() {
        return minOrder;
    }

    public void setMinOrder(BigDecimal minOrder) {
        this.minOrder = minOrder;
    }

    public Boolean getDiscountable() {
        return discountable;
    }

    public void setDiscountable(Boolean discountable) {
        this.discountable = discountable;
    }

    public BigDecimal getDiscount() {
        return discount;
    }

    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    public Map<String, Double> getPriceMap() {
        return priceMap;
    }

    public void setPriceMap(Map<String, Double> priceMap) {
        this.priceMap = priceMap;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getRefPrice() {
        return refPrice;
    }

    public void setRefPrice(BigDecimal refPrice) {
        this.refPrice = refPrice;
    }

    public BigDecimal getStock() {
        return stock;
    }

    public void setStock(BigDecimal stock) {
        this.stock = stock;
    }

    public Boolean getTax() {
        return tax;
    }

    public void setTax(Boolean tax) {
        this.tax = tax;
    }

    public BigDecimal getTaxRate() {
        return taxRate;
    }

    public void setTaxRate(BigDecimal taxRate) {
        this.taxRate = taxRate;
    }

    public Integer getDeliveryType() {
        return deliveryType;
    }

    public void setDeliveryType(Integer deliveryType) {
        this.deliveryType = deliveryType;
    }

    public Integer getFreightType() {
        return freightType;
    }

    public void setFreightType(Integer freightType) {
        this.freightType = freightType;
    }

    public BigDecimal getWeight() {
        return weight;
    }

    public void setWeight(BigDecimal weight) {
        this.weight = weight;
    }

    public Long getLogisticsTemplateId() {
        return logisticsTemplateId;
    }

    public void setLogisticsTemplateId(Long logisticsTemplateId) {
        this.logisticsTemplateId = logisticsTemplateId;
    }

    public Long getConsigneeId() {
        return consigneeId;
    }

    public void setConsigneeId(Long consigneeId) {
        this.consigneeId = consigneeId;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Boolean getCrossBorder() {
        return isCrossBorder;
    }

    public void setCrossBorder(Boolean crossBorder) {
        isCrossBorder = crossBorder;
    }

    public List<OrderPromotionVO> getPromotions() {
        return promotions;
    }

    public void setPromotions(List<OrderPromotionVO> promotions) {
        this.promotions = promotions;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        OrderProductDetailDTO that = (OrderProductDetailDTO) o;
        return Objects.equals(skuId, that.skuId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(skuId);
    }
}
